﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CRM.BLL.Ali;
using CRM.UTIL;

namespace CRM.WEB
{
    public partial class TaskScheduledGetOrder : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {

                var startDate = Request["startDate"] ?? string.Empty;
                var endDate = Request["endDate"] ?? string.Empty;
                if (!string.IsNullOrEmpty(startDate) && !string.IsNullOrEmpty(endDate) &&
                    Convert.ToDateTime(startDate).AddDays(1) == Convert.ToDateTime(endDate))
                {
                    var res = new StringBuilder();

                    int total = 0;
                    int c1 = 0;
                    int c2 = 0;
                    int c3 = 0;
                    int c4 = 0;
                    var str = CommonClass.Common.GetOrderList(Convert.ToDateTime(startDate),
                        Convert.ToDateTime(endDate),
                        out total, out c1, out c2, out c3, out c4);

                    Response.Write(res.AppendFormat(
                        "日期{0}至{1}中，订单总数量：{2}\r\n新增成功数量： {3}\r\n新增失败数量：{4}\r\n更新成功数量：{5}\r\n更新失败数量：{6}\r\n{7}",
                        startDate, endDate,
                        total,
                        c1, c2, c3, c4, str));
                }
                else
                {
                    Response.Write("Para Error.");
                }
            }
            catch (Exception ex)
            {
                Response.Write("URL ERROR: " + ex.Message + ex.StackTrace);
            }
        }
    }
}